import { simpleMatch } from './pattern'

const apiPathPatternNames = [
  { pattern: '*delete*', name: '删除' },
  { pattern: '*list*', name: '列表' },
  { pattern: '*update*', name: '修改' },
  { pattern: '*add*', name: '新增' },
  { pattern: '*save*', name: '编辑' }
]

export function getMatchApiName(name) {
  apiPathPatternNames.forEach(v => {
    if (simpleMatch(v.pattern, name)) {
      name = v.name
    }
  })
  return name
}
